package com.me.study.JVM;

import java.util.ArrayList;
import java.util.List;

/**
 * Java 虚拟机栈异常测试
 * VM options: -Xss1k   <p>
 *
 * <blockquote>
 *     类型   字节    长度    <p>
 *   boolean    1    8       <p>
 *     byte     1    8       <p>
 *     char     2    16      <p>
 *      int     4    32      <p>
 *    float     4    32      <p>
 *     long     8    64      <p>
 *   double     8    64      <p>
 * </blockquote>
 *
 * @author ME
 * @date   2019/3/7 11:36
 */
public class JvmStackException {

    public static void main(String[] args) {
        JvmStackException stack = new JvmStackException();
        int[] intArr = new int[1024 * 256];
        stack.stackLeak(intArr);
    }

    private void stackLeak(int[] intArr) {
        List<int[]> list = new ArrayList<>();
        for (int i = 0; i < 1024 * 4; i++) {
            // intArr[i] = i;
            list.add(new int[1024 * 256]);
            System.out.println(i);
        }
    }

}
